<!DOCTYPE html><html lang="zh-Hans"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"><meta name="description" content="常用算法"><meta name="keywords" content="算法"><meta name="author" content="kyren"><meta name="copyright" content="kyren"><title>常用算法 | Kyren's Blog</title><link rel="shortcut icon" href="/melody-favicon.ico"><link rel="stylesheet" href="/css/index.css?version=1.9.0"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/font-awesome@latest/css/font-awesome.min.css?version=1.9.0"><meta name="format-detection" content="telephone=no"><meta http-equiv="x-dns-prefetch-control" content="on"><link rel="dns-prefetch" href="https://cdn.jsdelivr.net"><link rel="dns-prefetch" href="https://hm.baidu.com"><script>var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?cf87fcdbd9ab7cf93d894f7c219ae78f";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();</script><meta http-equiv="Cache-Control" content="no-transform"><meta http-equiv="Cache-Control" content="no-siteapp"><script src="https://v1.hitokoto.cn/?encode=js&amp;charset=utf-8&amp;select=.footer_custom_text" defer></script><script>var GLOBAL_CONFIG = { 
  root: '/',
  algolia: undefined,
  localSearch: {"path":"search.xml","languages":{"hits_empty":"找不到您查询的内容:${query}"}},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  hexoVersion: '6.2.0'
} </script><meta name="generator" content="Hexo 6.2.0"></head><body><i class="fa fa-arrow-right" id="toggle-sidebar" aria-hidden="true"></i><div id="sidebar" data-display="true"><div class="toggle-sidebar-info text-center"><span data-toggle="切换文章详情">切换站点概览</span><hr></div><div class="sidebar-toc"><div class="sidebar-toc__title">目录</div><div class="sidebar-toc__progress"><span class="progress-notice">你已经读了</span><span class="progress-num">0</span><span class="progress-percentage">%</span><div class="sidebar-toc__progress-bar"></div></div><div class="sidebar-toc__content"><ol class="toc"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%B8%80%E3%80%81C%E8%AF%AD%E8%A8%80%E5%B8%B8%E7%94%A8%E7%AE%97%E6%B3%95"><span class="toc-number">1.</span> <span class="toc-text">一、C语言常用算法</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BA%8C%E3%80%81%E4%BA%A4%E4%BA%922%E4%B8%AA%E6%95%B0"><span class="toc-number">2.</span> <span class="toc-text">二、交互2个数</span></a></li></ol></div></div><div class="author-info hide"><div class="author-info__avatar text-center"><img src="https://avatars.githubusercontent.com/u/5827823?v=4"></div><div class="author-info__name text-center">kyren</div><div class="author-info__description text-center">huluo的技术博客</div><div class="follow-button"><a target="_blank" rel="noopener" href="https://github.com/huluo666">Follow Me</a></div><hr><div class="author-info-articles"><a class="author-info-articles__archives article-meta" href="/archives"><span class="pull-left">文章</span><span class="pull-right">239</span></a><a class="author-info-articles__tags article-meta" href="/tags"><span class="pull-left">标签</span><span class="pull-right">41</span></a><a class="author-info-articles__categories article-meta" href="/categories"><span class="pull-left">分类</span><span class="pull-right">29</span></a></div><hr><div class="author-info-links"><div class="author-info-links__title text-center">Links</div><a class="author-info-links__name text-center" target="_blank" rel="noopener" href="http://192.168.2.212:9090/">Jira</a><a class="author-info-links__name text-center" target="_blank" rel="noopener" href="http://192.168.2.212:8090/">Confluence</a><a class="author-info-links__name text-center" target="_blank" rel="noopener" href="http://bloc.leniugame.com/">Leniu</a></div></div></div><div id="content-outer"><div class="no-bg" id="top-container"><div id="page-header"><span class="pull-left"> <a id="site-name" href="/">Kyren's Blog</a></span><i class="fa fa-bars toggle-menu pull-right" aria-hidden="true"></i><span class="pull-right menus">   <a class="site-page" href="/">主页</a><a class="site-page" href="/essay">随笔</a><a class="site-page" href="/archives">归档</a><a class="site-page" href="/tags">标签</a><a class="site-page" href="/categories">分类</a><a class="site-page" href="/about">关于</a></span><span class="pull-right"><a class="site-page social-icon search"><i class="fa fa-search"></i><span> 搜索</span></a></span></div><div id="post-info"><div id="post-title">常用算法</div><div id="post-meta"><time class="post-meta__date"><i class="fa fa-calendar" aria-hidden="true"></i> 2017-10-10</time><span class="post-meta__separator">|</span><i class="fa fa-inbox post-meta__icon" aria-hidden="true"></i><a class="post-meta__categories" href="/categories/%E7%AE%97%E6%B3%95/">算法</a></div></div></div><div class="layout" id="content-inner"><article id="post"><div class="article-container" id="post-content"><h4 id="一、C语言常用算法"><a href="#一、C语言常用算法" class="headerlink" title="一、C语言常用算法"></a>一、C语言常用算法</h4><figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#<span class="keyword">include</span> <span class="string">&lt;stdio.h&gt;</span></span></span><br><span class="line"><span class="meta">#<span class="keyword">include</span> <span class="string">&lt;stdlib.h&gt;</span></span></span><br><span class="line"></span><br><span class="line"><span class="comment">//C语言中文网-算法 http://c.biancheng.net/cpp/u/c14/</span></span><br><span class="line"><span class="type">void</span> <span class="title function_">printArray</span><span class="params">(<span class="type">int</span> arr[],<span class="type">int</span> length)</span>;</span><br><span class="line"><span class="type">int</span> <span class="title function_">binarySearch0</span><span class="params">(<span class="type">int</span> a[], <span class="type">int</span> n, <span class="type">int</span> findNum)</span>;</span><br><span class="line"><span class="type">int</span> <span class="title function_">binarySearch</span><span class="params">(<span class="type">int</span> a[], <span class="type">int</span> low, <span class="type">int</span> high, <span class="type">int</span> findNum)</span>;</span><br><span class="line"><span class="type">void</span> <span class="title function_">bubble_sort</span><span class="params">(<span class="type">int</span> a[], <span class="type">int</span> n)</span>;</span><br><span class="line"><span class="type">void</span> <span class="title function_">select_sort</span><span class="params">(<span class="type">int</span> a[],<span class="type">int</span> n)</span>;</span><br><span class="line"></span><br><span class="line"><span class="type">int</span> <span class="title function_">main</span><span class="params">(<span class="type">int</span> argc, <span class="type">char</span> *argv[])</span> &#123;</span><br><span class="line">	<span class="built_in">printf</span>(<span class="string">&quot;hello world！&quot;</span>);</span><br><span class="line">	<span class="type">int</span> arr[] = &#123; <span class="number">1</span>, <span class="number">2</span>,<span class="number">5</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">8</span>, <span class="number">7</span>, <span class="number">6</span>, <span class="number">9</span> &#125;;</span><br><span class="line">	<span class="type">int</span> sz = <span class="keyword">sizeof</span>(arr) / <span class="keyword">sizeof</span>(arr[<span class="number">0</span>]); <span class="comment">//取得数组所占内存大小，再除以一个元素占用的内存大小来计算数组长度。</span></span><br><span class="line">	<span class="type">int</span> num = <span class="number">7</span>;</span><br><span class="line">	<span class="type">int</span> ret0=binarySearch0(arr, sz, num); <span class="comment">//二分法-普通</span></span><br><span class="line">	<span class="type">int</span> ret=binarySearch(arr,<span class="number">0</span>,sz, num);<span class="comment">//二分法-递归</span></span><br><span class="line"></span><br><span class="line">	printArray(arr,sz);</span><br><span class="line">	bubble_sort(arr,sz);</span><br><span class="line">	printArray(arr,sz);</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="type">void</span> <span class="title function_">printArray</span><span class="params">(<span class="type">int</span> arr[],<span class="type">int</span> length)</span>&#123;</span><br><span class="line">	<span class="comment">//不能再函数里获取数组长度</span></span><br><span class="line">	<span class="comment">//http://www.cnblogs.com/litifeng/p/7065384.html</span></span><br><span class="line">	<span class="built_in">printf</span>(<span class="string">&quot;\n&quot;</span>);</span><br><span class="line">	<span class="keyword">for</span>(<span class="type">int</span> i=<span class="number">0</span>;i&lt;length;i++)&#123;</span><br><span class="line">		<span class="built_in">printf</span>(<span class="string">&quot;%d-&gt;&quot;</span>,arr[i]);</span><br><span class="line">	&#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">/** </span></span><br><span class="line"><span class="comment">  * 二分查找普通实现。 </span></span><br><span class="line"><span class="comment">  * @param a 有序数组 </span></span><br><span class="line"><span class="comment">  * @param findNum 查找元素 </span></span><br><span class="line"><span class="comment">  * @return  不存在返回-1 </span></span><br><span class="line"><span class="comment">  */</span> </span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment">折半查找的原理：</span></span><br><span class="line"><span class="comment">1&gt; 数组必须是有序的</span></span><br><span class="line"><span class="comment">2&gt; 必须已知min和max（知道范围）</span></span><br><span class="line"><span class="comment">3&gt; 动态计算mid的值，取出mid对应的值进行比较</span></span><br><span class="line"><span class="comment">4&gt; 如果mid对应的值大于要查找的值，那么max要变小为mid-1</span></span><br><span class="line"><span class="comment">5&gt; 如果mid对应的值小于要查找的值，那么min要变大为mid+1</span></span><br><span class="line"><span class="comment">*/</span></span><br><span class="line"><span class="type">int</span> <span class="title function_">binarySearch0</span><span class="params">(<span class="type">int</span> a[], <span class="type">int</span> n, <span class="type">int</span> findNum)</span>&#123;</span><br><span class="line">	<span class="type">int</span> low = <span class="number">0</span>;</span><br><span class="line">	<span class="type">int</span> high = n - <span class="number">1</span>;</span><br><span class="line">	<span class="keyword">while</span>(low&lt;= high)&#123;</span><br><span class="line">		<span class="type">int</span> mid = (low + high)/<span class="number">2</span>;<span class="comment">//此处一定要放在while里面</span></span><br><span class="line">		<span class="type">int</span> midVal = a[mid];</span><br><span class="line">		<span class="keyword">if</span>(midVal&lt;findNum)</span><br><span class="line">			low = mid + <span class="number">1</span>;</span><br><span class="line">		<span class="keyword">else</span> <span class="keyword">if</span>(midVal&gt;findNum)</span><br><span class="line">			high = mid - <span class="number">1</span>;</span><br><span class="line">		<span class="keyword">else</span></span><br><span class="line">			<span class="keyword">return</span> mid;</span><br><span class="line">	&#125;</span><br><span class="line">	<span class="keyword">return</span> <span class="number">-1</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**二分法-递归方法*/</span></span><br><span class="line"><span class="type">int</span> <span class="title function_">binarySearch</span><span class="params">(<span class="type">int</span> a[], <span class="type">int</span> low, <span class="type">int</span> high, <span class="type">int</span> findNum)</span> &#123;  </span><br><span class="line">	<span class="type">int</span> mid = ( low + high ) / <span class="number">2</span>;       </span><br><span class="line">	<span class="keyword">if</span> (a[mid] == findNum) &#123;  </span><br><span class="line">		<span class="keyword">return</span> mid;  </span><br><span class="line">	&#125;  </span><br><span class="line"></span><br><span class="line">	<span class="keyword">if</span> (low &gt;= high) &#123;  </span><br><span class="line">		<span class="keyword">return</span> <span class="number">-1</span>;  </span><br><span class="line">	&#125; <span class="keyword">else</span>&#123;</span><br><span class="line">		 <span class="keyword">if</span> (a[mid]&lt;findNum) </span><br><span class="line">			<span class="keyword">return</span> binarySearch(a, mid + <span class="number">1</span>, high, findNum);  </span><br><span class="line">		 <span class="keyword">else</span> <span class="keyword">if</span> (a[mid]&gt;findNum) </span><br><span class="line">			<span class="keyword">return</span> binarySearch(a, low, mid - <span class="number">1</span>, findNum);  </span><br><span class="line">		 <span class="keyword">else</span></span><br><span class="line">			<span class="keyword">return</span> mid;   </span><br><span class="line">	&#125;</span><br><span class="line">&#125;  </span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * desc: 冒泡排序</span></span><br><span class="line"><span class="comment"> *	1. 进行两次遍历，第一个for是从 0 - arr.length-1, 第二次是从0到 arr.length - i - 1;</span></span><br><span class="line"><span class="comment"> * 	2. 每一趟之后最后一个是最大值；</span></span><br><span class="line"><span class="comment"> * </span></span><br><span class="line"><span class="comment"> * 时间复杂度: 最好情况o(n), 最差o(n^2), 平均o(n^2)</span></span><br><span class="line"><span class="comment"> * </span></span><br><span class="line"><span class="comment"> * 空间复杂度: 0(1)</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="type">void</span> <span class="title function_">bubble_sort</span><span class="params">(<span class="type">int</span> a[], <span class="type">int</span> n)</span></span><br><span class="line">&#123;</span><br><span class="line">	<span class="type">int</span> i, j, temp;<span class="comment">//temp中间变量</span></span><br><span class="line">	<span class="keyword">for</span> (j = <span class="number">0</span>; j &lt; n - <span class="number">1</span>; j++)  <span class="comment">//一定进行N-1轮比较</span></span><br><span class="line">	&#123;</span><br><span class="line">		<span class="keyword">for</span> (i = <span class="number">0</span>; i &lt; n - <span class="number">1</span> - j; i++) <span class="comment">//每一轮比较前n-1-i个，即已排序好的最后i个不用比较</span></span><br><span class="line">		&#123;</span><br><span class="line">			<span class="keyword">if</span>(a[i] &gt; a[i + <span class="number">1</span>]) <span class="comment">//升序--降序if(a[i] &lt; a[i + 1])</span></span><br><span class="line">			&#123;   <span class="comment">//如果前面一个数比后面数大，交换两个数的值  </span></span><br><span class="line">				temp = a[i];</span><br><span class="line">				a[i] = a[i + <span class="number">1</span>];</span><br><span class="line">				a[i + <span class="number">1</span>] = temp;</span><br><span class="line">			&#125;</span><br><span class="line">		&#125;</span><br><span class="line">	&#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * desc: 选择排序</span></span><br><span class="line"><span class="comment"> *	1. 分为两趟，第一趟从0-arr.length-1, 第二趟从i + 1到arr.length</span></span><br><span class="line"><span class="comment"> *	2. 每趟的结果是最小值在最左边</span></span><br><span class="line"><span class="comment"> * </span></span><br><span class="line"><span class="comment"> * 时间复杂度：最好情况o(n^2), 最差o(n^2), 平均o(n^2)</span></span><br><span class="line"><span class="comment"> * </span></span><br><span class="line"><span class="comment"> * 空间复杂度：o(1)</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="type">void</span> <span class="title function_">select_sort</span><span class="params">(<span class="type">int</span> a[],<span class="type">int</span> n)</span><span class="comment">//n为数组a的元素个数</span></span><br><span class="line">&#123;</span><br><span class="line">	<span class="comment">//进行N-1轮选择</span></span><br><span class="line">	<span class="keyword">for</span>(<span class="type">int</span> i=<span class="number">0</span>; i&lt;n<span class="number">-1</span>; i++) <span class="comment">//趟数</span></span><br><span class="line">	&#123;</span><br><span class="line">		<span class="type">int</span> min_index = i; </span><br><span class="line">		<span class="comment">//找出第i小的数所在的位置</span></span><br><span class="line">		<span class="keyword">for</span>(<span class="type">int</span> j=i+<span class="number">1</span>; j&lt;n; j++) <span class="comment">//比较次数</span></span><br><span class="line">		&#123;</span><br><span class="line">			<span class="keyword">if</span>(a[j] &lt; a[min_index])</span><br><span class="line">			&#123;</span><br><span class="line">				min_index = j;</span><br><span class="line">			&#125;</span><br><span class="line">		&#125;</span><br><span class="line">		<span class="comment">//将第i小的数，放在第i个位置；如果刚好，就不用交换</span></span><br><span class="line">		<span class="keyword">if</span>( i != min_index)</span><br><span class="line">		&#123;</span><br><span class="line">			<span class="type">int</span> temp = a[i];</span><br><span class="line">			a[i] = a[min_index];</span><br><span class="line">			a[min_index] = temp;</span><br><span class="line">		&#125;</span><br><span class="line">	&#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">//在程序里，交换2个数，我使用了异或来处理。这个可以根据个人喜好。为了避免产生临时变量，可以使用如下几种方式来交换2个数：</span></span><br></pre></td></tr></table></figure>

<h4 id="二、交互2个数"><a href="#二、交互2个数" class="headerlink" title="二、交互2个数"></a>二、交互2个数</h4><p>在程序里，交换2个数，我使用了异或来处理。这个可以根据个人喜好。为了避免产生临时变量，可以使用如下几种方式来交换2个数：</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line"><span class="type">void</span> <span class="title function_">swap</span><span class="params">(<span class="type">int</span> &amp;a, <span class="type">int</span> &amp;b)</span> &#123;</span><br><span class="line">  <span class="type">int</span> temp = a;</span><br><span class="line">  a = b;</span><br><span class="line">  b = temp;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="type">void</span> <span class="title function_">swap</span><span class="params">(<span class="type">int</span> &amp;a, <span class="type">int</span> &amp;b)</span> &#123;</span><br><span class="line">  a = a ^ b;</span><br><span class="line">  b = b ^ a;</span><br><span class="line">  a = a ^ b;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="type">void</span> <span class="title function_">swap</span><span class="params">(<span class="type">int</span> &amp;a, <span class="type">int</span> &amp;b)</span> &#123;</span><br><span class="line">   a=a+b;</span><br><span class="line">   b=a-b;</span><br><span class="line">   a=a-b;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p><a target="_blank" rel="noopener" href="https://stackoverflow.com/questions/46463778/xcode-9-an-error-occurred-uploading-to-the-itunes-store">https://stackoverflow.com/questions/46463778/xcode-9-an-error-occurred-uploading-to-the-itunes-store</a></p>
<p><a target="_blank" rel="noopener" href="http://c.biancheng.net/cpp/html/2571.html">C语言选择排序</a></p>
<p>算法</p>
<p><a target="_blank" rel="noopener" href="http://www.jianshu.com/p/f5baf7f27a7e">各种排序算法总结</a></p>
<p><a target="_blank" rel="noopener" href="http://www.jianshu.com/p/ae97c3ceea8d">排序算法总结</a></p>
<p><a target="_blank" rel="noopener" href="http://www.jianshu.com/p/8abad5e9432b">笔试时，冒泡排序也要写得优雅出众</a></p>
<p><a target="_blank" rel="noopener" href="https://www.jianshu.com/p/d50eac247452">iOS算法总结-插入排序</a></p>
<p><a target="_blank" rel="noopener" href="http://www.jianshu.com/p/1b4068ccd505">JS家的排序算法</a></p>
<p><a target="_blank" rel="noopener" href="http://www.jianshu.com/p/28d0f65aa6a1">数据结构_排序算法总结</a></p>
<p><a target="_blank" rel="noopener" href="http://www.jianshu.com/p/70619984fbc6">排序算法图形化比较：快速排序、插入排序、选择排序、冒泡排序</a></p>
<p><a target="_blank" rel="noopener" href="http://www.jianshu.com/p/d8a5712a9b08">21天C语言代码训练营（第一天）</a></p>
</div></article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">文章作者: </span><span class="post-copyright-info"><a href="mailto:undefined">kyren</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">文章链接: </span><span class="post-copyright-info"><a href="http://huluo666.gitee.io/2017/10/10/常用算法/">http://huluo666.gitee.io/2017/10/10/常用算法/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a target="_blank" rel="noopener" href="https://creativecommons.org/licenses/by-nc-sa/4.0/">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="http://huluo666.gitee.io">Kyren's Blog</a>！</span></div></div><div class="post-meta__tag-list"><a class="post-meta__tags" href="/tags/%E7%AE%97%E6%B3%95/">算法</a></div><nav id="pagination"><div class="prev-post pull-left"><a href="/2017/10/10/%E5%8E%BB%E9%87%8D%EF%BC%8C%E6%9F%A5%E6%89%BE%E9%87%8D%E5%A4%8D%E5%85%83%E7%B4%A0/"><i class="fa fa-chevron-left">  </i><span>iOS数组去重</span></a></div><div class="next-post pull-right"><a href="/2017/10/10/JavaScript%E6%89%93%E5%8D%B0%E5%AF%B9%E8%B1%A1/"><span>JavaScript打印对象循环引用问题</span><i class="fa fa-chevron-right"></i></a></div></nav></div></div><footer><div class="layout" id="footer"><div class="copyright">&copy;2022 By kyren</div><div class="framework-info"><span>驱动 - </span><a target="_blank" rel="noopener" href="http://hexo.io"><span>Hexo</span></a><span class="footer-separator">|</span><span>主题 - </span><a target="_blank" rel="noopener" href="https://github.com/Molunerfinn/hexo-theme-melody"><span>Melody</span></a></div><div class="footer_custom_text">hitokoto</div><div class="busuanzi"><script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script><span id="busuanzi_container_page_pv"><i class="fa fa-file"></i><span id="busuanzi_value_page_pv"></span><span></span></span></div></div></footer><i class="fa fa-arrow-up" id="go-up" aria-hidden="true"></i><script src="https://cdn.jsdelivr.net/npm/animejs@latest/lib/anime.min.js"></script><script src="https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.js"></script><script src="https://cdn.jsdelivr.net/npm/velocity-animate@latest/velocity.min.js"></script><script src="https://cdn.jsdelivr.net/npm/velocity-ui-pack@latest/velocity.ui.min.js"></script><script src="/js/utils.js?version=1.9.0"></script><script src="/js/fancybox.js?version=1.9.0"></script><script src="/js/sidebar.js?version=1.9.0"></script><script src="/js/copy.js?version=1.9.0"></script><script src="/js/fireworks.js?version=1.9.0"></script><script src="/js/transition.js?version=1.9.0"></script><script src="/js/scroll.js?version=1.9.0"></script><script src="/js/head.js?version=1.9.0"></script><script src="/js/search/local-search.js"></script><script>if(/Android|webOS|iPhone|iPod|iPad|BlackBerry/i.test(navigator.userAgent)) {
  $('#nav').addClass('is-mobile')
  $('footer').addClass('is-mobile')
  $('#top-container').addClass('is-mobile')
}</script><div class="search-dialog" id="local-search"><div class="search-dialog__title" id="local-search-title">本地搜索</div><div id="local-input-panel"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章"></div></div></div><hr><div id="local-search-results"><div id="local-hits"></div><div id="local-stats"><div class="local-search-stats__hr" id="hr"><span>由</span> <a target="_blank" rel="noopener" href="https://github.com/wzpan/hexo-generator-search" style="color:#49B1F5;">hexo-generator-search</a>
 <span>提供支持</span></div></div></div><span class="search-close-button"><i class="fa fa-times"></i></span></div><div class="search-mask"></div></body></html>